package com.powermgr.boringtest.controller;

import com.powermgr.boringtest.bean.PrData;
import com.powermgr.boringtest.result.Result;
import com.powermgr.boringtest.service.IPrService;
import com.powermgr.boringtest.service.IStartService;
import lombok.extern.log4j.Log4j2;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

/**
 * PullRequestController
 *
 * @author qiuxiangdong
 * @date 2023/6/12
 */
@RestController
@Log4j2
public class PullRequestController {
    @Resource
    private IStartService startService;
    @Resource
    private IPrService prService;

    @CrossOrigin
    @RequestMapping(value = "start", method = RequestMethod.POST)
    public Result<Object> powerPr(@RequestBody PrData data) {
        return startService.start(data);
    }

    @CrossOrigin
    @RequestMapping(value = "label", method = RequestMethod.POST)
    public Result<Object> getPrTag(@RequestBody PrData body) {
        return prService.getPrTag(body.getPrUrl());
    }
}
